package com.example.demo.service.impl;

import com.alibaba.fastjson.JSON;
import com.example.demo.mapper.RunCountMapper;
import com.example.demo.pojo.RunCount;
import com.example.demo.service.RunCountServlet;
import jdk.nashorn.internal.runtime.Undefined;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class Runcountimpl implements RunCountServlet {
    @Resource
    RunCountMapper runCount;
    @Override
    public List<RunCount> RunCountorder(String date) {
        List<RunCount> a=runCount.RunCountorder(date);
        return a;
    }

    @Override
    public List<RunCount> RunCountworker(String date) {
        List<RunCount> a =runCount.RunCountworker(date);
        return a;
    }

    @Override
    public List<RunCount> RunCountbussion(String date) {
        List<RunCount> a=runCount.RunCountbussion(date);
        return a;
    }

    @Override
    public String runcountshow(String date) {
        Map<String,Object> map=new HashMap<String,Object>();

        List<RunCount> a=runCount.RunCountbussion( date);
        map.put("bussion",a);
        List<RunCount> b =runCount.RunCountworker(date);
        map.put("worker",b);
        List<RunCount> c=runCount.RunCountorder(date);
        map.put("order",c);
        return JSON.toJSONString(map);
    }
}
